<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dao Implement Using Demo By Ayin</title>

    <?php
        require("./com/yin/DaoImpl/SQLHelper.php");
    ?>

</head>
<body>
    <?php

        // Mysql 用户名
        $username = "root";

        // Mysql 密码
        $password = "";

        // 服务器地址
        $serverName = "localhost";

        // 目标数据库
        $databaseName = "rpi";

        $sqlhelper = new SQLHelper($username, $password, $serverName);
        $sqlhelper->selectDatabase($databaseName);
        
        // 插入例子
        $sqlhelper->insertInto("rpi_data", "38", "0", "27.82", "12.662", "80", "1");
        echo("<br>");

        // 查询例子
        $result = $sqlhelper->selectAll("rpi_data");
        while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {

            echo("音量数据: ");
            echo($row["volume_data"]);
            echo("<br>");

            echo("人体红外数据: ");
            echo($row["peopleInfrared_data"]);
            echo("<br>");

            echo("温度数据: ");
            echo($row["temperature_data"]);
            echo("<br>");

            echo("重力数据: ");
            echo($row["weight_data"]);
            echo("<br>");

            echo("烟雾数据: ");
            echo($row["smoke_data"]);
            echo("<br>");

            echo("烟雾TTL数据: ");
            echo($row["smokeTTL_data"]);
            echo("<br>");
        }
    ?>
</body>
</html>